import type { ExtractPropTypes, PropType } from 'vue'
import type { CellSizeType } from '../grid/types'
import type { ColumnType } from './types'

const tableProps = {
  columns: {
    type: Array as PropType<ColumnType[]>,
    required: true
  },
  dataSource: {
    type: Array as PropType<any[]>,
    default: () => []
  },
  width: {
    type: Number,
    required: true
  },
  height: {
    type: Number,
    required: true
  },
  headerHeight: {
    type: Number
  },
  rowHeight: {
    type: [Number, Function] as PropType<CellSizeType>
  },
  estimatedColumnWidth: {
    type: Number
  },
  estimatedRowHeight: {
    type: Number
  },
  overscanColumnCount: {
    type: Number,
    default: 2
  },
  overscanRowCount: {
    type: Number,
    default: 2
  },
  border: {
    type: Boolean,
    default: true
  },
  stripe: {
    type: Boolean,
    default: true
  },
  rowClassName: {
    type: Function as PropType<(record: any, index: number) => string>
  },
  showHeader: {
    type: Boolean,
    default: true
  },
  enableHorizontal: {
    type: Boolean,
    default: false
  },
  enableVertical: {
    type: Boolean,
    default: true
  }
} as const

export { tableProps }
export type TableProps = ExtractPropTypes<typeof tableProps>
